
#define SHM_INI_IMPLEMENTATION 1
#define SHM_QUEUE_IMPLEMENTATION 1
#define SHM_LOG_PRINTER_IMPLEMENTATION 1
#include "shm_log_printer.h"
#include <signal.h>

shm_log_printer_t printer;

static void sighandler(int signum) {
  shm_log_printer_stop(&printer);
}

int main(int argc, char* argv[]) {
  int rslt = 0;
  const char *log_config = "log_service.ini";
  const char *log_name = "test";
  if (argc > 2) {
    log_config = argv[1];
    log_name = argv[2];
  } else {
    printf("shm_log_printer log.ini test\n");
    return -1;
  }

  rslt = shm_log_printer_init(&printer, log_config, log_name);
  if (rslt != 0) {
    printf("shm_log_printer_init error rslt:%d\n", rslt);
    return -1;
  }

  signal(SIGINT, sighandler);
  signal(SIGQUIT, sighandler);
  shm_log_printer_run(&printer);
  shm_log_printer_deinit(&printer);
  return 0;
}
